module Gadgets
  class BoxButton < Gtk::HBox
    def initialize(&func)
      super
      @entry = Gtk::Entry.new
      
      @entry.editable = false
      b = Gtk::Button.new("...")
      
      b.signal_connect('button-press-event') do |item, event|
        func.call
      end
      self.set_width_request(16)
      self.add(@entry)
      self.pack_start(b,false,false)
      self.set_width_request(100)
    end
    
    def text=(text)
      @entry.text = text
    end
  end
end